home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / readme.txt < prev    next >
Text File  |  1993-08-08  |  7KB  |  137 lines

  1. Notes on the C++ code for "The C++ Answer Book" by Tony L. Hansen,
  2. Addison-Wesley, 1990, ISBN 0-302-11497-6.
  3.  
  4. ............................. The Layout .............................
  5.  
  6. Each exercise is a file, e.g. "2.1" to "2.11". There are also files named
  7. "tools", "shape" and "appendixB". Each is a shell archive, which can be
  8. picked apart using sh or a text editor.  So to get everything, you would
  9. have to say
  10.  
  11.     send 2.1 from c++/answerbook
  12.     send 2.2 from c++/answerbook
  13.     send 2.3 from c++/answerbook
  14.     ...
  15.     send 8.8 from c++/answerbook
  16.     send 8.9 from c++/answerbook
  17.     send appendixB from c++/answerbook
  18.     send shape from c++/answerbook
  19.     send tools from c++/answerbook
  20.  
  21. But of course you don't need to get everything at once, just ask for the
  22. particular exercise you're interested in at the moment. The complete list is
  23.  
  24. 2.1        3.10       3.9        4.7        6.1        6.7        8.11
  25. 2.10       3.11       4.1        4.8        6.10       6.8        8.12
  26. 2.11       3.12       4.10       4.9        6.11       6.9        8.13
  27. 2.12       3.13       4.11       5.1        6.12       7.1        8.2
  28. 2.13       3.14       4.12       5.10       6.13       7.10       8.3
  29. 2.14       3.15       4.13       5.11       6.14       7.2        8.4
  30. 2.2        3.16       4.14       5.12       6.15       7.3        8.5
  31. 2.3        3.17       4.15       5.2        6.16       7.4        8.6
  32. 2.4        3.2        4.16       5.3        6.17       7.5        8.7
  33. 2.5        3.3        4.17       5.4        6.18       7.6        8.8
  34. 2.6        3.4        4.2        5.5        6.2        7.7        8.9
  35. 2.7        3.5        4.3        5.6        6.3        7.8        shape
  36. 2.8        3.6        4.4        5.7        6.4        7.9        tools
  37. 2.9        3.7        4.5        5.8        6.5        8.1        appendixB
  38. 3.1        3.8        4.6        5.9        6.6        8.10
  39.  
  40. ............................ The Makefiles ...........................
  41.  
  42. The makefiles are designed for use on a UNIX machine running an AT&T C++
  43. release. Each makefile has two major targets: the target "all" will create
  44. one or more test programs which use the exercise text, and the target "test"
  45. which will run a series of tests using those test programs. The tests all
  46. consist of running a test program and comparing the output with comparison
  47. files which you will also find present. The makefiles also assume a
  48. directory structure where each chapter is kept in a separate directory named
  49. "ch1" to "ch8", and each exercise is kept in a directory under ch* named
  50. something like "3.2dir".
  51.  
  52. ............................. The Code ..............................
  53.  
  54. When you look at the C files, you will occassionally note some "scaffolding"
  55. which is not printed in the C++ Answer Book. These consist of several forms
  56. of special C++ comments which were noted during the mechanical processing of
  57. the code into what was printed in the book.
  58.  
  59.     // EXPAND
  60.  
  61.     Lines marked thus are all #include lines. The files may have been
  62.     separated to either ease the printing process or the testing process.
  63.     Whichever, the expanded files were what was printed in the book.
  64.  
  65.     // DELETE
  66.  
  67.     Lines marked thus are all code put into place to help either the
  68.     debugging process or the testing process. All such lines which also
  69.     refer to "debug" can be safely removed without affecting the code.
  70.     Note that these lines were also not printed in the book.
  71.  
  72. .................. Notes on the tools directory ......................
  73.  
  74. Much of the code uses a header file named <debug.h> for debugging purposes.
  75. This header file may be found in "tools", along with <error.h> and error.c.
  76. <debug.h> introduces a single static variable "debug" which is initialized
  77. to the value of the environment variable "DEBUG". It is then used in code
  78. such as the following:
  79.  
  80.     if (debug > 3) cerr << "Value of i=" << i << "\n"; // DEBUG
  81.     or
  82.     if (debug & 512) cerr << "Value of i=" << i << "\n"; // DEBUG
  83.  
  84.  
  85. ......................... Notes on <stream.h> ........................
  86.  
  87. All of the code was written using <stream.h>. For those of you with
  88. <iostream.h> available, most of the code runs without change. Note that the
  89. code in chapter 8 which mucks with the internals of <stream.h> really does
  90. discuss the older version of <stream.h> and you may have to make some
  91. serious modifications to get it to work under <iostream.h>. Or if you have
  92. it, just use <Ostream.h>.
  93.  
  94. ......................... Notes on ch7/shape .........................
  95.  
  96. When working in Chapter 7, you will have to build the sources in the "shape"
  97. file before any of the exercises. The contents of the shape file should go
  98. into a directory named ch7/shape in order for the other makefiles in chapter
  99. 7 to work. This code is a copy of the code in Chapter 7 of "The C++
  100. Programming Language" by Bjarne Stroustrup.
  101.  
  102. ....................... Notes on 1.2 vs. 2.0 Specifics ...............
  103.  
  104. All of the code was originally written for compilers based on 1987 C++ spec
  105. (that accepted by the 1.2 AT&T release). All of the code in this book does
  106. work on the AT&T 2.0 compiler, although some of code will generate warning
  107. messages about using such anachronisms as calling a member function on a
  108. const object without declare the member function as const.
  109.  
  110. Some other 2.0-based compilers are more picky about what anachronisms they
  111. will accept. The necessary changes are minor and should not affect the code
  112. itself.
  113.  
  114. I have found a few compilers which have problems with unsigned shorts, so
  115. consequently the code which uses unsigned shorts extensively, such as class
  116. arbint, may have problems if you run into those machines. Use the tests to
  117. make certain. Also note that different releases of some compilers will have
  118. different bugs.
  119.  
  120. Another problem with some compilers is that they do not accept the full
  121. language. Some compilers do not accept unary operator+, for example.
  122. Whenever I ran into a compiler bug, I usually just reported the bug to the
  123. appropriate people and got the code to run using a different compiler.
  124.  
  125. ........................... Closing Remarks ..........................
  126.  
  127. I hope that this code is of use to you. Although the code HAS been
  128. extensively tested, there is always a possibility that I did not test some
  129. particular case, or some code isn't as portable as it should be. If any
  130. problems are found, I certainly wish to hear of them. I will add updates to
  131. the archive as necessary. Also, if there are any problems with this archive
  132. as found on research!netlib, please let me know.
  133.  
  134.                     Tony L. Hansen
  135.                 att!pegasus!hansen, attmail!tony
  136.                     hansen@pegasus.att.com
  137.